﻿<%
	'判断是否登录
	function isLogin()
		dim USERNAME,PASSWORD
		USERNAME = request.Cookies("USERINFO")("USERNAME")
		PASSWORD = request.Cookies("USERINFO")("PASSWORD")
		
		'判断Cookie存不存在
		if USERNAME = "" or PASSWORD = "" then
			isLogin = false
			exit function
		end if
		
		'存在的情况下判断是否正确
		dim rs,sql
		sql = "select * from USERS where USERNAME = '"& USERNAME &"' and PASSWORD = '"& PASSWORD &"'"
		set rs = db.query(sql)
		if not rs.eof then
			isLogin = true
		else
			isLogin = false
		end if
		rs.close
		set rs = nothing
	end function
	
	'没有登录直接跳转到登录画面
	if not isLogin then
		response.Redirect("/admin/login.asp")
	end if
%>